home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18021 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  775 b 

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: blumenberg@aol.com (Blumenberg)
  3. Newsgroups: comp.lang.c++
  4. Subject: Printing fixed length char arrays in C++?
  5. Date: 18 Apr 1996 11:51:01 -0400
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4l5od5$7kg@newsbf02.news.aol.com>
  9. Reply-To: blumenberg@aol.com (Blumenberg)
  10. NNTP-Posting-Host: newsbf02.mail.aol.com
  11.  
  12. How do I print fixed length char arrays (not null-term'ed strings) in C++?
  13.  
  14. In C I would use something like:
  15.     char abc[3] = {'a','b','c'};
  16.     printf("result=%.*s\n",sizeof abc,abc);
  17.  
  18. How would I do this in C++ iostreams?  I tried playing with setw() and
  19. setprecision(), but they don't produce the desired effect.
  20. Any suggestions?
  21. Thanks,
  22. Dwayne
  23. blumenberg@aol.com
  24.